< previous page page_15 next page >

Page 15
   Line (0, 0)(100, 100) 
   Line -(200, 400) 
   Line -(300, 300) 
   Line -(400, 500)
The Line method honors custom coordinates, so it places the line's end points where they belong in the current coordinate system.
Circle Method
The Circle method draws circles, ellipses, and sections of circles and ellipses. It uses the syntax:
Circle Step(x, y), radius, color, start, end, aspect
Step
If you include the Step keyword, the X and Y coordinates of the circle's center are relative to the end of your last drawing command.
(x, y)
The coordinates where you want the center of the circle.
radius
The radius of the circle.
color
The color of the circle.
start, end
The starting and ending angles for drawing an arc or pie slice.
aspect
The aspect ratio (height divided by width) for drawing ellipses.

The angles used by the Circle method are measured counterclockwise in radians where a horizontal line to the right lies along the angle 0. Figure 1.6 shows how Visual Basic measures angles.
You can convert from radians to degrees using the following formulas.
e10a6a0a59f035e870d90cca05b85fce.gif
radians = degrees / 180 * 3.14159265
degrees = radians * 180 / 3.1415926
The Circle method has several interesting features. If you set start to a negative number, Circle draws a line from the center of the circle to the starting point and then treats start as a positive angle. Similarly, if end is negative, the Circle method draws a line from the center to the end position and treats end as a positive angle. Using these features, you can draw pie slices. The commands below draw the pie slice shown in Figure 1.7.
e10a6a0a59f035e870d90cca05b85fce.gif
Const PI = 3.14159265 
Circle (50, 50), 30, , -
p / 6, -p * 0.75
z0035-01.gif
Figure 1.6
Measuring angles in Visual Basic.

 
< previous page page_15 next page >